/**
 * Copyright (c) 2012 Axa Holding Belgium, SA. All rights reserved.
 * This software is the confidential and proprietary information of the AXA Group.
 */
package chabernac.android.wordbattle;

import chabernac.android.tools.SingleObjectQueue;
import chabernac.android.wordbattle.paint.iDrawable;
import chabernac.android.wordbattle.paint.animation.ExplodingTextAnimator;

public class GameDrawerDelegate {
  private final SingleObjectQueue<iDrawable> myDrawableQueue;
  private ExplodingTextAnimator myExplodingTextAnimator = null;
  private iDrawable myLastGameDrawable = null;
  
  public GameDrawerDelegate( SingleObjectQueue<iDrawable> aDrawableQueue ) {
    super();
    myDrawableQueue = aDrawableQueue;
  }

  public void drawGame(iDrawable aGameDrawable){
    myDrawableQueue.put( aGameDrawable );
    if(myExplodingTextAnimator != null){
      myExplodingTextAnimator.setBackGroundDrawable( aGameDrawable );
    }
    myLastGameDrawable = aGameDrawable;
  }
  
  public void startExplodingTextAnimation(String aText){
    myExplodingTextAnimator = new ExplodingTextAnimator( aText, myLastGameDrawable, myDrawableQueue );
    myExplodingTextAnimator.start(); 
  }

}
